﻿using Microsoft.AspNetCore.Mvc;
using UserService.Services;
using UserService.Services.Dtos;
using Volo.Abp.Application.Dtos;
using Volo.Abp.AspNetCore.Mvc;

namespace UserService.Controllers;

[Route("api/userservice/[action]")]
public class UserController : AbpController, IUserService
{
    public IUserService userService { get; set; }

    public UserController()
    {

    }

    [HttpPost]
    public async Task<UserDto> CreateAsync(UserDto input)
    {

        return await userService.CreateAsync(input);
    }

    [HttpDelete]
    public async Task DeleteAsync(Guid id)
    {
        await userService.DeleteAsync(id);
    }

    [HttpGet]
    public async Task<UserDto> GetAsync(Guid id)
    {
        return await userService.GetAsync(id);
    }

    [HttpPost]
    public async Task<PagedResultDto<UserDto>> GetListAsync(PagedAndSortedResultRequestDto input)
    {
        return await userService.GetListAsync(input);
    }

    [HttpPut]
    public async Task<UserDto> UpdateAsync(Guid id, UserDto input)
    {
        return await userService.UpdateAsync(id, input);
    }
}
